package com.example.cdpbookstore.dao.impl;

import com.example.cdpbookstore.dao.CategoryDao;
import com.example.cdpbookstore.pojo.entity.Category;
import com.example.cdpbookstore.tool.C3P0Tool;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.util.List;

public class CategoryDaoImpl implements CategoryDao {
    @Override
    public List<Category> list() {
        String sql = "select * from tb_category";
        try {
            return C3P0Tool.queryRunner.query(sql, new BeanListHandler<>(Category.class));
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}
